<template>
	<view class="uni-tab-bar">
		<scroll-view scroll-x class="uni-swiper-tab" :style="scrollStyle">
			<block v-for="(tab,idx)  in tabBars" :key="tab.id">
				<view class="swiper-tab-list" :class="{'active': tabIndex == idx}" @tap="tabTap(idx)" :style="scrollItemStyle">
					{{tab.name}}
					{{tab.number?tab.number:''}}
					<view class="swiper-tab-line"></view>
				</view>
			</block>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		props: {
			tabBars: Array,
			tabIndex: Number,
			scrollStyle:{
				type: String,
				default: ""
			},
			scrollItemStyle:{
				type: String,
				default: ""
			}
		},
		methods: {
			tabTap(idx){
				this.$emit('tabTap', idx);
			}
		}
	}
</script>

<style scoped>
.uni-swiper-tab{
		border-bottom:1u px solid #eee;
	}
	.swiper-tab-list{
		color: #969696;
		font-weight: bold;
	}
	.uni-tab-bar .active{
		color: #343434;
		
	}
	.active .swiper-tab-line{
		border-bottom: 10upx solid #fede33;
		width: 70upx;
		margin: auto;
		border-radius: 20upx;
	}
</style>
